Skip to content

Fix: Test memory leak and Failing test when md5 and sha are enabled - #11025

Merged
dgarske merged 4 commits into
wolfSSL:masterfrom
aidankeefe2022:test-fix-for-md5-and-sha-enabled
Aug 6, 2026
Merged

Fix: Test memory leak and Failing test when md5 and sha are enabled#11025
dgarske merged 4 commits into
wolfSSL:masterfrom
aidankeefe2022:test-fix-for-md5-and-sha-enabled

Conversation

@aidankeefe2022

Copy link
Copy Markdown
Member

Description

Fixed a memory leak where if _ret is already failing, the rngInit function will not run, causing rngFree to free garbage data. The fix was to have rngInit always run to match with rngFree by swapping ExpectInt to DoExpectInt. Fixed failing test where WC_SIG_MIN_HASH_TYPE was not properly set for --enable-sha and --enable-md5, so we skip under those conditions.

Found while testing wolfCLU

Testing

Code no longer leaks, and code no longer fails with the wrong code for the test when SHA and MD5 are enabled

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m3

  • FLASH: .text +24 B (+0.0%, 122,943 B / 262,144 B, total: 47% used)

gcc-arm-cortex-m4

  • FLASH: .text +64 B (+0.0%, 201,109 B / 262,144 B, total: 77% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .text +320 B (+0.2%, 181,924 B / 1,048,576 B, total: 17% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .text +640 B (+0.1%, 772,844 B / 1,048,576 B, total: 74% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +896 B (+0.3%, 281,088 B / 1,048,576 B, total: 27% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +512 B (+0.2%, 327,192 B / 1,048,576 B, total: 31% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +64 B (+0.1%, 123,739 B / 262,144 B, total: 47% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +384 B (+0.2%, 237,255 B / 262,144 B, total: 91% used)

gcc-arm-cortex-m7

  • FLASH: .text +64 B (+0.0%, 201,109 B / 262,144 B, total: 77% used)

gcc-arm-cortex-m7-pq

  • FLASH: .text +896 B (+0.3%, 281,664 B / 1,048,576 B, total: 27% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +384 B (+0.2%, 237,319 B / 262,144 B, total: 91% used)

linuxkm-pie

  • Data: __patchable_function_entries +64 B (+0.2%, 26,440 B)

linuxkm-standard

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐺 Skoll Code Review

Overall recommendation: APPROVE
Findings: 6 total — 2 posted, 4 skipped

Posted findings

  • [Medium] Weak-hash guard is skipped even when WC_SIG_MIN_HASH_TYPE raises the floor, and silently self-destructs if the default ever moves into a headertests/api/test_signature.c:338
  • [Medium] Lowered-floor branch of wc_SignatureCheckHashStrength() has no coverage at alltests/api/test_signature.c:338
Skipped findings
  • [Low] PR description attributes the failure to --enable-sha/--enable-md5, but the trigger is --enable-wolfclu
  • [Low] Two different init/free-pairing conventions now coexist in this file
  • [Low] Weak-hash assertions skipped for any WC_SIG_MIN_HASH_TYPE override, including stronger floors
  • [Info] Guard depends on WC_SIG_MIN_HASH_TYPE's default living in signature.c, not a public header

Review generated by Skoll via Claude/Codex

Comment thread tests/api/test_signature.c Outdated
Comment thread tests/api/test_signature.c Outdated
@aidankeefe2022

Copy link
Copy Markdown
Member Author

Retest this please

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐺 Skoll Code Review

Overall recommendation: APPROVE
Findings: 2 total — 2 posted, 0 skipped

Posted findings

  • [Medium] Lowered-floor else branch at the generate site calls wc_SignatureVerify() instead of wc_SignatureGenerate()tests/api/test_signature.c:538-544
  • [Low] Guard compares wc_HashType enum values; the library compares digest sizes, and the two disagree in real configstests/api/test_signature.c:345,532

Review generated by Skoll via Claude/Codex

Comment thread tests/api/test_signature.c Outdated
Comment thread tests/api/test_signature.c Outdated
@aidankeefe2022
aidankeefe2022 force-pushed the test-fix-for-md5-and-sha-enabled branch from 6ae7980 to 41c6766 Compare August 4, 2026 21:59
@aidankeefe2022

Copy link
Copy Markdown
Member Author

Fix for failing tests was resolved by #11026 but fix for memory leak on failure is real and DoExpect for rng init should still go in

@Frauschi

Frauschi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Jenkins retest this please

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐺 Skoll Code Review

Overall recommendation: APPROVE
Findings: 3 total — 1 posted, 2 skipped

Posted findings

  • [Medium] RNG fix deviates from the file's own (and the repo's dominant) zero-then-init idiomtests/api/test_signature.c:307
Skipped findings
  • [Low] PR description no longer matches the diff: the WC_SIG_MIN_HASH_TYPE half already landed on master
  • [Info] Fix is unverified by execution in this review environment

Review generated by Skoll via Claude/Codex

Comment thread tests/api/test_signature.c Outdated
@aidankeefe2022

Copy link
Copy Markdown
Member Author

retest this please

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dgarske
dgarske merged commit 073d4e2 into wolfSSL:master Aug 6, 2026
358 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants